<?php

/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: admincp_members.php 31986 2012-10-30 05:18:16Z chenmengshu $
 */

if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}
	if(getgpc('succeed') == 1){
		cpmsg('groups_setting_succeed', 'action=plugins&identifier=group_manager&pmod=search', 'succeed');
	}
	$groupselect = array();
	$usergroupid = isset($_GET['usergroupid']) && is_array($_GET['usergroupid']) ? $_GET['usergroupid'] : array();
	$query = C::t('common_usergroup')->fetch_all_not(array(6, 7), true);
	foreach($query as $group) {
		$group['type'] = $group['type'] == 'special' && $group['radminid'] ? 'specialadmin' : $group['type'];
		$groupselect[$group['type']] .= "<option value=\"$group[groupid]\" ".(in_array($group['groupid'], $usergroupid) ? 'selected' : '').">$group[grouptitle]</option>\n";
	}
	$groupselect = '<optgroup label="'.$lang['usergroups_member'].'">'.$groupselect['member'].'</optgroup>'.
		($groupselect['special'] ? '<optgroup label="'.$lang['usergroups_special'].'">'.$groupselect['special'].'</optgroup>' : '').
		($groupselect['specialadmin'] ? '<optgroup label="'.$lang['usergroups_specialadmin'].'">'.$groupselect['specialadmin'].'</optgroup>' : '').
		'<optgroup label="'.$lang['usergroups_system'].'">'.$groupselect['system'].'</optgroup>';
	showformheader("plugins&identifier=group_manager&pmod=search");
	showtableheader();
	showsetting('members_search_group', '', '', '<select name="groupid[]" multiple="multiple" size="10">'.$groupselect.'</select>');
	showtablefooter();
	showsubmit('submit',  'search');
	showformfooter();
	$groups = $_GET['groupid'];
	if(!empty($groups)){
		include_once DISCUZ_ROOT.'./source/plugin/group_manager/result.inc.php';
	}else{
		echo lang('plugin/group_manager', 'no_result');
	}
	
?>